mainloop: Only delete pid watch if we found the right pid
authorColin Walters <walters@verbum.org>
Thu, 19 Jan 2012 23:30:45 +0000 (18:30 -0500)
committerColin Walters <walters@verbum.org>
Thu, 19 Jan 2012 23:30:45 +0000 (18:30 -0500)
src/ostbuild/pyostbuild/mainloop.py

index fb4d9457c5cce1a75bed4ce2895a29e7fd6f9de6..cc72fb6a527f0f583b166e1bbc55ba4cf8b52f37 100644 (file)
@@ -69,9 +69,9 @@ class Mainloop(object):
         to_delete_pids = []
         for pid in self._pid_watches:
             (opid, status) = os.waitpid(pid, os.WNOHANG)
-            if opid != 0:
+            if opid == pid:
                 to_delete_pids.append(pid)
-                self._pid_watches[pid](opid, status)
+                self._pid_watches[pid](pid, status)
         for pid in to_delete_pids:
             del self._pid_watches[pid]
         newtime = time.time() * 1000